﻿<Page x:Class="SMS.Shell.Views.InvoiceView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="800"
	Title="InvoiceView">

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0" Width="300">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" Text="选择货物"/>
            <ComboBox Grid.Row="1" Name="_listKeywords" SelectionChanged="_listKeywords_SelectionChanged">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <DataGrid Name="_gridCargoSource" Grid.Row="2" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True">
                <DataGrid.Columns>
                    <DataGridTemplateColumn Header="名称" Width="*">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Button Name="_btnSelect" Click="_btnSelect_Click">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="点击添加 "/>
                                        <TextBlock Text="{Binding Caption}" FontWeight="Bold"/>
                                        <TextBlock Text=" 到发货列表中"/>
                                    </StackPanel>
                                </Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Name="_panelCustomer" Orientation="Horizontal">
                <TextBlock Text="收货:"/>
                <TextBlock Text="{Binding Caption}"/>
                <TextBlock Text="联系人:"/>
                <TextBlock Text="{Binding ContactPerson}"/>
                <TextBlock Text="联系电话:"/>
                <TextBlock Text="{Binding Telephone}"/>
            </StackPanel>
            <DataGrid Name="_gridCargo" ItemsSource="{Binding Cargos}" Grid.Row="1" AutoGenerateColumns="False" CanUserAddRows="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="名称" Binding="{Binding Path=Cargo.Caption}" Width="*" IsReadOnly="True"/>
                    <DataGridTextColumn Header="条码" Binding="{Binding Path=Cargo.Code}" Width="*" IsReadOnly="True"/>
                    <DataGridTextColumn Header="规格" Binding="{Binding Path=Cargo.Specifications}" Width="*" IsReadOnly="True"/>
                    <DataGridTextColumn Header="单瓶价格" Binding="{Binding Path=Cargo.UnitPrice}" Width="*" IsReadOnly="True"/>
                    <DataGridTextColumn Header="整箱价格" Binding="{Binding Path=Price, Mode=TwoWay}" Width="*"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
    </Grid>
</Page>
